package org.lq.swket.ssm.controller;

import org.lq.swket.ssm.dto.DemoDTO;
import org.lq.swket.ssm.service.DemoService;
import org.lq.swket.ssm.vo.DemoVO;
import org.lq.swket.ssm.vo.util.Populate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/demo")
public class DemoController {

    @Autowired
    private DemoService demoService ;

    @GetMapping("/test")
    public DemoVO selectById(Integer id) throws Exception {
        DemoDTO demoDTO = demoService.search(id);
        DemoVO demoVO = new DemoVO();
        Populate.demoDTOToDemoVO(demoDTO,demoVO);
        return demoVO;
    }
}
